<?php
include_once '../action/cutiKolektifController.php';
include 'z_header.php';
if(!isset($_SESSION['nip'])){
    header('location:login.php');
}
?>
<div class="container">  
<div class="row">
<table class="table table-striped table-bordered" >  
    <fieldset>  
         <legend>Daftar Pengajuan Cuti</legend>  
        <thead>  
          <tr>  
            <th>Nama & NIP Pengaju</th>  
            <th>Jenis Cuti</th>
            <th>Tgl Cuti</th>
            <th>Durasi Cuti</th>
            <th>Penanggung Jawab</th>  
            <th>Ambil Keputusan</th>
          </tr>  
        </thead>  
        <tbody> 
            <?php if($cuti_all!=NULL){
                    foreach($cuti_all as $key){ ?>
                    <td><?php echo $key->nip_pengaju.'<br>'.$key->nama_pengaju;?></td>
                    <td><?php echo $key->kategori_cuti;?></td>
                    <td><?php echo $key->tanggal_awal.' s/d '.'<br>'.$key->tanggal_akhir;?></td>
                    td><?php echo $key->durasi_cuti;?></td>
                    <td><?php echo $key->nip_pengganti.'<br>'.$key->nama_pengganti;?></td>
                    <td>
                        <?php if($_SESSION['pejabat']=='1' OR $_SESSION['pejabat']!='T'){
                            $seksi=explode(",",$key->id_seksi);?>
                        <form method="post" action="">
                            <input type="hidden" name="id_cuti" value="<?php echo $key->id_cuti; ?>">
                            <?php if($_SESSION['bagian']=='1'AND $seksi[0]!=$_SESSION['bagian']){ ?>
                            <input type="submit" class="btn-danger" name="tolak_kk" value="Tolak">
                            <input type="submit" class="btn-primary" name="setuju_kk" value="Setujui">
                            <?php }
                                  if($_SESSION['pejabat']!='T' AND $_SESSION['bagian']!='1' AND $seksi[0]!=$_SESSION['bagian']){ ?>
                            <input type="submit" class="btn-danger" name="tolak_kasi" value="Tolak">
                            <input type="submit" class="btn-primary" name="setuju_kasi" value="Setujui">
                            <?php } ?>
                        </form>
                        <?php } ?>
                    </td>
                    
                    <?php }
            } ?>
        </tbody>  
        </fieldset>
</table>
<?php include_once 'z_footer.php'; 